<?php
/**
 * 模拟post提交数据
 * User: Administrator
 * Time: 2015/10/27 10:18
 */

//$data = array(
//	'enews'=>'AddFeedback',
//	'ecmsfrom'=>'/',
//	'bid'=>'2',
//	'email'=>'test@qq.om',
//	'title'=>'just test',
//	'saytext'=>'just test',
//);
//$ch = curl_init('http://localhost:80/phpinput_post.php');
//curl_setopt($ch, CURLOPT_RETURNTRANSFER, true) ;
//curl_setopt($ch,CURLOPT_POST,1);
//curl_setopt($ch,CURLOPT_POSTFIELDS,http_build_query($data));
//$res =  curl_exec($ch);
//curl_close($ch);
//print($res).PHP_EOL;

//@file phpinput_xmlrpc.php
$http_entity_body = "\n\n   jt_userinfo\n";
$http_entity_type = 'text/html';
$http_entity_length = strlen($http_entity_body);
$host = 'localhost';
$port = 80;
$path = '/phpinput_server.php';
$fp = fsockopen($host, $port, $error_no, $error_desc, 30);
if ($fp) {
	fputs($fp, "POST {$path} HTTP/1.1\r\n");
	fputs($fp, "Host: {$host}\r\n");
	fputs($fp, "Content-Type: {$http_entity_type}\r\n");
	fputs($fp, "Content-Length: {$http_entity_length}\r\n");
	fputs($fp, "Connection: close\r\n\r\n");
	fputs($fp, $http_entity_body . "\r\n\r\n");
	while (!feof($fp)) {
		$d .= fgets($fp, 4096);
	}

	fclose($fp);
	echo $d;
}